#!/bin/sh

INSTALL_DESTINATION="$2"
FW_DL_APP="$INSTALL_DESTINATION/Firmware Download Utility.app"

# There are generally newer firmware images available after packaging the
# Firmware Download Utility app.  These images are poked into the installer
# package, so we need to copy them from there to the location that the utility
# expects.
FW_DEST="$FW_DL_APP/Contents/Resources"
cp -fv \
    "$PACKAGE_PATH"/Contents/Resources/product.*.bin \
    "$FW_DEST"/
# Guard against umask surprises.
chmod -vv a-x,u+rw,go+r "$FW_DEST"/product.*.bin

# Open the Firmware Download Utility application.
echo "Running the Firmware Download Utility."
open "$FW_DL_APP"

